package com.yulongtian.weekCompetition.month202302.week04;

import java.util.Arrays;

/**
 * 可
 *
 * @author yulongTian
 * @create 2023-02-26 10:43
 */
public class Test02 {
    public static void main(String[] args) {
        System.out.println(Arrays.toString(new Test02().divisibilityArray("100000000010000000003019999999961000000000", 1000000000)));
    }

    public int[] divisibilityArray(String word, int m) {
        if (word.equals("")) {
            return new int[]{};
        }
        int len = word.length();
        int[] ans = new int[len];
        //余数
        long remainder = 0L;
        for (int i = 0; i < word.length(); i++) {
            long current = remainder * 10 + word.charAt(i) - '0';
            remainder = current % m;
            if (remainder == 0) {
                ans[i] = 1;
            }
        }
        return ans;
    }

}
